<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<body>
<script>
    var str2 = "?appid=wxf0e81c3bee622d60&redirect_uri=http%3A%2F%2Fnba.bluewebgame.com%2Foauth_response.php&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect";
    var str = "?ADTAG=tsts&code=021M3SoM1pBWq41zYeoM17C6pM1M3SoQ&state=xyz";
    var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
    var reg2 = "=";
    var r = str2.substr(1).match(reg2);
    console.log(r);

    console.log(GetQueryString('appid'));   //wxf0e81c3bee622d60
    if(GetQueryString('appid')!=null){
        var Cappi = GetQueryString('appid');
        localStorage.setItem('Cappid',Cappi)
    }

    function GetQueryString(name){
        var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
        var r = str2.substr(1).match(reg);
        if(r!=null)return  decodeURIComponent(r[2]); return null;
    }


    var payOpenId = localStorage.getItem("payOpenId");  //如果没有，返回null
    console.log(payOpenId);
    console.log(payOpenId==undefined);  //返回true

    //测试调用函数，参数不匹配
    console.log("========================");
    ab("2","3");        //验证结果：参数个数少了也能调用函数，只是没赋值的参数值为undefined
    function ab(a,b,c) {
        console.log(c);
        console.log(a+b+c);
    }
</script>
<h2>Hello World! 【hahaha】-------- 目录</h2>
</body>
</html>
